package cn.iocoder.yudao.module.member.service.profit;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.member.controller.admin.profit.vo.ProfitMainPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.profit.vo.ProfitMainSaveReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.profit.ProfitMainDO;
import cn.iocoder.yudao.module.member.dal.mysql.profit.ProfitMainMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

@Slf4j
@Service
@Validated
public class ProfitMainServiceImpl implements ProfitMainService{

    @Resource
    private ProfitMainMapper profitMainMapper;



    @Override
    public Long createProfitMain(ProfitMainSaveReqVO createReqVO) {
        // 插入
        ProfitMainDO profitMain = BeanUtils.toBean(createReqVO, ProfitMainDO.class);
        profitMainMapper.insert(profitMain);
        // 返回
        return profitMain.getId();
    }
    @Override
    public PageResult<ProfitMainDO> getProfitMainPage(ProfitMainPageReqVO pageReqVO) {
        return profitMainMapper.selectPage(pageReqVO);
    }
}
